package com.youyi.yychosesdk.SDK;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.app.AppCompatActivity;
import com.youyi.yychosesdk.Builder.AlbumBuilder;
import com.youyi.yychosesdk.EasyPhotos;
import com.youyi.yychosesdk.GlideEngine;
import com.youyi.yychosesdk.callback.SelectCallback;
import com.youyi.yychosesdk.constant.Type;
import com.youyi.yychosesdk.engine.ImageEngine;
import com.youyi.yychosesdk.models.album.entity.Photo;
import java.util.ArrayList;

public class YYChoseSDKActivity extends AppCompatActivity {
    /* access modifiers changed from: protected */
    @Override // android.support.v7.app.AppCompatActivity, android.support.v4.app.SupportActivity, android.support.v4.app.FragmentActivity
    public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        getWindow().addFlags(16);
        if (bundle == null) {
            resloveIntent(getIntent());
        }
    }

    /* access modifiers changed from: protected */
    @Override // android.support.v4.app.FragmentActivity
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        resloveIntent(getIntent());
    }

    private void resloveIntent(Intent intent) {
        String stringExtra = intent.getStringExtra("choseType");
        int intExtra = intent.getIntExtra("num", 1);
        boolean booleanExtra = intent.getBooleanExtra("showCamera", false);
        int i = ChoseType.valueOf(stringExtra).ordinal();
        if (i == 1) {
            AlbumBuilder createCamera = EasyPhotos.createCamera((FragmentActivity) this, true);
            createCamera.setFileProviderAuthority(getPackageName() + "_fileprovider").setCleanMenu(false).start(new SelectCallback() {
                /* class com.youyi.yychosesdk.SDK.YYChoseSDKActivity.AnonymousClass1 */

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onResult(ArrayList<Photo> arrayList, boolean z) {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onResult(arrayList, true);
                        YYChoseSDKActivity.this.finish();
                    }
                }

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onCancel() {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onCancel();
                        YYChoseSDKActivity.this.finish();
                    }
                }
            });
        } else if (i == 2) {
            AlbumBuilder count = EasyPhotos.createAlbum((FragmentActivity) this, booleanExtra, false, (ImageEngine) GlideEngine.getInstance()).setCount(intExtra);
            count.setFileProviderAuthority(getPackageName() + "_fileprovider").setCleanMenu(false).start(new SelectCallback() {
                /* class com.youyi.yychosesdk.SDK.YYChoseSDKActivity.AnonymousClass2 */

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onResult(ArrayList<Photo> arrayList, boolean z) {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onResult(arrayList, true);
                        YYChoseSDKActivity.this.finish();
                    }
                }

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onCancel() {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onCancel();
                        YYChoseSDKActivity.this.finish();
                    }
                }
            });
        } else if (i == 3) {
            AlbumBuilder createAlbum = EasyPhotos.createAlbum((FragmentActivity) this, booleanExtra, true, (ImageEngine) GlideEngine.getInstance());
            createAlbum.setFileProviderAuthority(getPackageName() + "_fileprovider").setCount(intExtra).filter(Type.VIDEO).onlyVideo().setCleanMenu(false).start(new SelectCallback() {
                /* class com.youyi.yychosesdk.SDK.YYChoseSDKActivity.AnonymousClass3 */

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onResult(ArrayList<Photo> arrayList, boolean z) {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onResult(arrayList, true);
                        YYChoseSDKActivity.this.finish();
                    }
                }

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onCancel() {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onCancel();
                        YYChoseSDKActivity.this.finish();
                    }
                }
            });
        } else if (i == 4) {
            AlbumBuilder createAlbum2 = EasyPhotos.createAlbum((FragmentActivity) this, false, true, (ImageEngine) GlideEngine.getInstance());
            createAlbum2.setFileProviderAuthority(getPackageName() + "_fileprovider").setCount(intExtra).onlyGif().setGif(true).setCleanMenu(false).start(new SelectCallback() {
                /* class com.youyi.yychosesdk.SDK.YYChoseSDKActivity.AnonymousClass4 */

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onResult(ArrayList<Photo> arrayList, boolean z) {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onResult(arrayList, true);
                        YYChoseSDKActivity.this.finish();
                    }
                }

                @Override // com.youyi.yychosesdk.callback.SelectCallback
                public void onCancel() {
                    if (YYChoseSDK.mOnSelectListener != null) {
                        YYChoseSDK.mOnSelectListener.onCancel();
                        YYChoseSDKActivity.this.finish();
                    }
                }
            });
        }
    }
}
